import { PrimaryGeneratedColumn } from "typeorm";
import { Code, CreateDate, DateTime, Digdit, Entity, Int, Link, Name, PrimaryKey, PrimaryUuid, UpdateDate } from "../utils";

@Entity({
    name: 'auto_red'
})
export class AutoRed {
    @PrimaryKey()
    key: string;

    @Name()
    name: string;

    @Digdit()
    count: number;

    @CreateDate()
    create_date: Date;

    @UpdateDate()
    update_date: Date;

    @Name({
        default: `com.smile.gifmaker`
    })
    pkg: string;

    @Name({ default: '' })
    user_id: string;

    @Name({ default: '' })
    ksid: string;

}

@Entity({
    name: 'auto_red_open_log'
})
export class AutoRedOpenLog {
    @PrimaryGeneratedColumn()
    id: number;

    @Code()
    device_id: string;

    @Code()
    device_name: string;

    @Digdit({ default: 0 })
    count: number;

    // 0 等待开奖
    @Code({ default: `0` })
    status: string;

    @DateTime({ nullable: true })
    join_date: Date;

    @DateTime({ nullable: true })
    open_date: Date;

    @Int()
    log_id: number;

    @CreateDate()
    create_date: Date;

    @UpdateDate()
    update_date: Date;
}


@Entity({
    name: 'auto_red_log'
})
export class AutoRedLog {

    @PrimaryGeneratedColumn()
    id: number;

    @Code()
    device_id: string;

    @Code()
    device_name: string;

    @Code()
    red_key: string;

    @Code()
    red_name: string;

    @CreateDate()
    create_date: Date;

    @Link({ default: '' })
    link: string;

    @Name({
        default: `com.smile.gifmaker`
    })
    pkg: string;

    @DateTime({ nullable: true })
    open_date: Date;

    @Name({ default: '' })
    user_id: string;

    @Name({ default: '' })
    ksid: string;

    @Digdit({ default: 0 })
    count: number;

    @Digdit({ default: 0 })
    online: number;

    @Digdit({ default: 3 })
    can_join: number;
    
    @Code({ default: '' })
    origin_url: string;
}